Share: Frontend App Messaging
Apps can share messages with each other by using these interfaces.
Functions
edger.app.open(target[, letter])
target
{Object} Target App information.letter
{Object} A letter message send to target. Default: undefined.- Returns: {Promise} Promise object.
Send a message to the target App. If the target App is not running, EdgerOS will launch the target App and switch it to the foreground, if the target App is already running, EdgerOS will switch it to the foreground.
The target
object contains the following members:
id
{String} Target App bundle ID, for example:'com.acoinfo.setting'
.
The letter
object contains the following members:
type
{String} Types of messages shared. This is defined by the target App. Check below "Support" table for more information.msg
{Object} Message sent to the target.
Example
edger.app.open({ id: 'com.acoinfo.setting' }, {
type: 'about',
msg: {
...
}
}).then((data) => {
if (data.success) {
console.log('Letter send ok!');
}
}).catch(error => {
console.error(error);
});
async / await
async function share(id, type, msg) {
const ret = await edger.app.open({ id }, { type, msg });
return ret.success;
}
edger.app.appworld(id)
id
{String} Target App id, for example:'com.company.appname'
.- Returns: {Promise} Promise object.
Open the specified App page in EdgerWorld.
Example
edger.app.appworld('com.acoinfo.setting').then((data) => {
if (data.success) {
console.log('ok!');
}
}).catch(error => {
console.error(error);
});
async / await
async function appworld(id) {
const ret = await edger.app.appworld(id);
return ret.success;
}
edger.app.browser(url)
url
{String} Target url.- Returns: {Promise} Promise object.
Open url in browser.
Example
// If you do not have browser permission, please apply first
const weWantPerms = ['browser'];
edger.permission.request({
code: weWantPerms,
type: 'phone'
}).then((ret) => {
if (!ret.success) return
edger.app.browser('https://www.edgeros.com/').then((data) => {
if (data.success) {
console.log('ok!');
}
}).catch(error => {
console.error(error);
});
})
edger.app.letter()
- Returns: {Promise} Promise object.
Get the latest letter information, EdgerOS reserves a letter message for each App front-end, which can be obtained through this interface, which is generally called in the active
event detection function.
Example
edger.onAction(`active`, () => {
edger.app.letter().then((letter) => {
if (letter != undefined) {
// The current app got a letter
}
}).catch(error => {
console.error(error);
});
});
The obtained letter
object contains the following members:
type
{String} Type information from the sender.msg
{Object} Message from the sender.from
{String} Sender App bundle ID.
Support
edger.app.open(target[, letter]) supports the following features
The following APIs are provided for development to open corresponding functions.
The feature field represents a specific system function. You can directly enter the corresponding system functions through the corresponding parameters.
com.acoinfo.setting
)
Setting app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
首屏 | home | { } | >=1.5.1 |
关于本机 | about | { } | >=1.5.1 |
系统更新 | upgrade | { } | >=1.5.1 |
桌面设置 | desktop | { } | >=1.5.1 |
氛围灯 | led | { } | >=2.2.6 |
信息统计 | info-generic | { } | >=1.5.1 |
存储空间 | info-disk | { } | >=1.5.1 |
隐私与安全 | privacy | { } | >=1.5.1 |
语言 | language | { } | >=1.5.1 |
日期与时区 | time | { } | >=2.2.6 |
开机启动 | autostart | { } | >=1.5.1 |
节流模式 | low-resource | { } | >=2.2.6 |
开发模式 | devmode | { } | >=2.2.6 |
网络设置 | network | { } | >=2.2.6 |
授信证书 | certificate | { } | >=2.2.6 |
显示输出 | display | { } | >=2.2.6 |
存储器管理 | storage | { } | >=2.0.0 |
一键启动 | favorite | { } | >=2.0.0 |
还原爱智 | reset | { } | >=2.2.6 |
系统权限 | system-permission | { } | >=1.5.1 |
设备权限 | device-permission | { } | >=1.5.1 |
应用权限 | app-permission | { } | >=1.5.1 |
应急密码 | emergency-password | { } | >=2.2.6 |
com.acoinfo.device
)
Device app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
我的设备 | devices | { } | >=1.5.1 |
设备配网 | smartConfig | { } | >=1.5.1 |
扫描设备 | add | { } | >=1.5.1 |
高级设置 | advanced-setting | { } | >=2.2.6 |
设备详情 | detail | { } | >=1.5.1 |
设置 | setting | { } | >=2.0.0 |
标签管理 | setting-tag | { } | >=2.0.0 |
MQTT | setting-mqtt | { } | >=2.0.0 |
热点问题 | setting-question | { } | >=2.0.0 |
问题详情 | timsetting-question-detaile | { } | >=2.0.0 |
com.acoinfo.lora
)
Lora app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
添加设备 | add | { } | >=1.5.1 |
设备列表 | devices | { } | >=2.0.0 |
com.acoinfo.router
)
Router app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
首屏 | home | { } | >=2.0.0 |
Wi-Fi 管理 | wifi | { } | >=2.0.0 |
设备列表 | devices | { } | >=2.0.0 |
路由设置 | setting | { } | >=1.5.1 |
黑名单设置 | blocks | { } | >=2.0.0 |
com.acoinfo.edgerworld
)
Edgerworld app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
首屏 | home | { } | >=2.0.0 |
搜索 | search | { } | >=2.0.0 |
个人中心 | user | { } | >=2.0.0 |
应用详情 | eap-detail | { } | >=2.0.0 |
应用详情 | open | { } | >=2.2.4 |
新鲜上榜 | fresh | { } | >=2.2.4 |
大家都在用 | everyone | { } | >=2.2.4 |
装机必备 | necessary | { } | >=2.2.4 |
免费应用排行 | free-rank | { } | >=2.2.4 |
付费应用排行 | pay-rank | { } | >=2.2.4 |
分类 | classify | { } | >=2.2.4 |
智慧家庭 | home-classify | { } | >=2.2.4 |
智能汽车 | car-classify | { } | >=2.2.4 |
智慧工厂 | factory-classify | { } | >=2.2.4 |
已购应用 | history | { } | >=2.2.4 |
com.acoinfo.user
)
User app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
首屏 | home | { } | >=2.0.0 |
管理员 | administrator | { } | >=2.2.6 |
用户 | user | { } | >=2.2.0 |
邀请用户 | invite | { } | >=2.0.0 |
新建分组 | add-group | { } | >=2.2.6 |
用户列表 | groups | { } | >=2.0.0 |
分组详情 | users | { } | >=2.2.6 |
com.acoinfo.nas
)
Nas app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
首屏 | home | {"tab": "photo"} | >=2.2.6 |
备份设置 | backupSet | { } | >=2.2.6 |
回收站 | trash | { } | >=2.2.6 |
特权 | member | { } | >=2.2.6 |
com.acoinfo.printer
)
Printer app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
首屏 | home | { } | >=2.2.6 |
快速打印 | quick-print | { url: '', name: '', ext: '', mediaType: ''} | >=2.2.6 |
com.acoinfo.thinc
)
Thinc app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
首屏 | home | { } | >=2.2.6 |
创建 | add | { } | >=2.2.6 |
消息提醒 | message-page | { } | >=2.2.6 |
教程 | help | { } | >=2.2.6 |
一键使用 | one-touch-start | { } | >=2.2.6 |
com.acoinfo.homecast
)
Homecast app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
首屏 | home | { } | >=2.2.6 |
设置 | setting | { } | >=2.2.6 |
com.acoinfo.guide
)
Guide app commands support list (Bundle ID: feature | type | msg | version |
---|---|---|---|
用户手册 | user-manual | { } | >=2.2.6 |
Example
The following code will open the Setting
app, and switch to the About
function.
edger.app.open({ id: 'com.acoinfo.setting' }, {
type: 'about',
msg: {}
}).then((data) => {
if (data.success) {
console.log('Letter send ok!');
}
}).catch(error => {
console.error(error);
});
async / await
async function share(id, type, msg) {
const ret = await edger.app.open({ id }, { type, msg });
return ret.success;
};
share('com.acoinfo.setting', 'about')